home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilhard / frame.lha / FrameGrab / grab.txt < prev    next >
Text File  |  1996-12-29  |  20KB  |  476 lines

  1. Amiga Framegrabber.
  2. Software version 3.
  3. Hardware revision 6.
  4. (C)1996 LJS.
  5.  
  6.  
  7. Check your hardware is up to date!!!!!!
  8.  
  9. Fast Data Aquisition!
  10.  
  11. I will not be held responsible for any damages or injury due to misuse or
  12. incorrect construction of this device.  Building and use of this device is
  13. at the risk of the constructor/user.
  14.  
  15. Shareware.
  16.  
  17. This project and included software is shareware.
  18. Registration fee is 10 pounds sterling.  This is a small price to pay
  19. considering
  20. the amount of work and research that has gone into producing this.
  21. What you will get.
  22. You will get any later versions of the software and details of any
  23. modifications/improvements to the hardware.
  24.  
  25.  
  26. Film etc.
  27.  
  28. Remember you dont know who gets hold of your piccies if you release them.
  29. If you are capturing from films etc... 20th sweaty sox or whoever may
  30. take offence if you are using their stuff from films and using it to
  31. advertise breath mints or something.  And then you get fined by the nuts
  32. for some junk you dont really care about.
  33.  
  34. I have changed the example file for this exact reason!!!!
  35.  
  36. Included files.
  37.  
  38. You should find in this archive:-
  39. 3 IFF schematic files.
  40. This file!
  41. And the frame grab software.
  42. Some example piccies.
  43.  
  44. Frame Grabber.
  45.  
  46. I needed a device which would capture a single frame from a video signal.
  47.  The frame grabber described here has only been tested with the British PAL
  48. system.  Other PAL systems should work although I don't know about the NTSC
  49. system.  The SECAM system may also work as this is quite similar to the PAL
  50. system.  The only thing that would prevent the grabber to work on different
  51. systems is the polarity and periodic time of the horizontal and vertical
  52. sync. pulses.  Also the bandwidth of the input signal to the grabber will
  53. affect the results.
  54.  
  55. This project works on the PAL(I) standard.  It will probably work on most
  56. other video standards.  Here are the standards for other places if
  57. you dont know what you've got!
  58.  
  59. PAL(I)
  60. Gibraltar, Hong Kong, Malvinas, Republic of Ireland, UK.
  61.  
  62. PAL(B/G/H) (This should work)
  63. Afghanistan, Algeria, Australia, Bahrain, Bangladesh, Belgium, Bosnia
  64. Brunei, Central African Republic, Denmark, Equatorial Guinea, Ethiopia,
  65. Finland, Germany, Ghana, Greenland, Iceland, India, Indonesia, Jordan
  66. Kenya, Kuwait, Liberia, Luxembourg, Malaysia, Maldives, Malta,
  67. Mozambique, Netherlands, New Zealand, Nigeria, Norway, Oman, Pakistan
  68. Portugal, Qatar, Serbia, Seychelles, Sierra Leone, Singapore, Spain
  69. Sri Lanka, Sudan, Swaziland, Sweden, Switzerland, Tanzania, Thailand,
  70. Yemen Arab Republic, Turkey, United Arab Emirates, former
  71. Yugoslavian territories, Zambia.
  72.  
  73. NTSC(M) (Dunno about this, probbably work though)
  74. Antigua and Barbuda, Bahamas, Barbados, Belize, Bermuda, Bolivia, Burma
  75. Canada, Chile, Colombia, Costa Rica, Cuba, Dominican Republic, Ecuador
  76. Guatemala, Haiti, Honduras, Jamaica, Japan, Kampuchea, Mexico,
  77. Micronesia, Nicaragua, Panama, Peru, Philippines, Puerto Rico,
  78. Saint Christopher and Nevis, Saint Lucia, Samoa, South Korea, Surinam
  79. Taiwan, Trinidad and Tobago, United States of America, Venezuela.
  80.  
  81. SECAM (This is similar to PAL)
  82. France, People's republic of China, most African territories not already
  83. listed, most areas of the Commonwealth of Independant States and former
  84. Soviet satellite nations.
  85.  
  86. Let me know if I have missed you out or misplaced you!
  87.  
  88. Operation.
  89.  
  90. The unit when built is simple to operate.  A composite video signal is
  91. connected to the input of the grabber (get this from the back of your video
  92. recorder (Most have a video in/out and audio in/out connector)).
  93. Play the video tape you want to grab pictures off and when the picture you
  94. want comes up press a nice capture button on the front of the unit.
  95. The next video frame will be captured (this process happens very fast).
  96. After you have your image captured all you do then is transfer the data
  97. (128kbytes worth) into your Amiga.  This is done through the parallel port.
  98. Then the image is decoded by the frame grab software into a normal IFF
  99. picture which you can edit (Print out and make posters for your propaganda,
  100. obey me or 'I'll be back' etc..)
  101.  
  102. The parts.
  103.  
  104. You shouldn't have much trouble in obtaining parts for the frame grab.
  105. Saying that I have heard that the 74123 is hard to source since it
  106. apparently isn't manufactured anymore but I am looking into this.
  107.  
  108. *I have looked into this and removed the chip from the design *8-)
  109.  
  110.  Most parts are standard components (There aren't any weird martian
  111. components in it).  The only two chips that may cause a problem (apart from
  112. handing your hard earned cash over for them) are the 128k memory chip and
  113. the Flash A/D converter (They aren't that obscure, most electronics places
  114. should have them (Maplins definite in UK)).  All the other parts are widely
  115. available.
  116.  
  117. Further stuff.
  118.  
  119. I think I will be keeping this project up to date.  Speeding things up and
  120. improving picture quality, bringing the construction costs down that sort
  121. of thing.  So you know if you build this thing then you can be sure of
  122. further developments on it popping up allover the place.
  123.  
  124. My approach.
  125.  
  126. The grabber is pretty much straight forward.  The video signal once inside
  127. the grabber is split up into three bits.  The unchanged video signal goes
  128. directly to the A/D converter.  From the video signal the horizontal
  129. (H.sync.) and vertical (V.sync.) sync. pulses are split out from the rest
  130. of the junk.  The H.sync. pulses which occur at the beginning of each TV
  131. line are simply stored on bit 7 in the RAM and do nothing else in the
  132. circuit.  The V.sync. pulse goes to an input of a AND gate.  The push
  133. button (grab button) simply sets a Flip-Flop after being debounced by
  134. another Flip-Flop.  When the output from the Grab button flip flop is high
  135. AND a V.sync pulse is detected yet another flip flop is set.  This last
  136. flip flop enables an oscillator which runs at 6.5MHz (In theory a signal
  137. should be sampled at twice its maximum frequency so for a video signal the
  138. sampling frequency should be 11MHz but in practice you can get away with
  139. just over (6.5MHz).  If you own a sound sampler you will know you can get
  140. acceptable results when you sample at some stupidly low frequency like
  141. 8kHz, in theory you should sample audio signals at twice the band width.
  142.  The band width for audio is 20kHz (Hi-Fi) so you should sample at 40kHz
  143. but you don't need to in practice).  Boy that was a long bracketed thing
  144. wasn't it?
  145. The oscillator clocks the A/D converter and a large binary counter (used to
  146. address the memory chip).  Each sample is stored at a different address in
  147. memory.  The grabber resets all the flip flops and stops the oscillator
  148. when the memory chip is full (It also resets the address counters).
  149. The oscillator is infact a free running oscillator, the output is just
  150. gated with an AND gate.
  151. The data held in the RAM is then ready to be transferred to the Amiga.
  152.  
  153.  
  154. Big grindy gears!
  155.  
  156. All this thing is, is an electronic 'gear'  it slows the video information
  157. down to a speed the computer can handle.  If you had a computer which could
  158. access the parallel port at video speeds you wouldn't need this equipment.
  159. BUT your stuck with slow parallel ports so you have to build this *8-(
  160.  
  161. Power supply.
  162.  
  163. The power supply for the main board is 5 volts (surprise surprise).
  164. The project includes its own regulation circuit so you can stuff in any
  165. voltage between 8 and 35 volts (I think its 35V I cant be bothered
  166. searching through data sheets to find the correct value).
  167. Supplying the maximum would be stupid, the power regulator would get very
  168. hot and probably decide to output the full input voltage, blowing up all
  169. your expensive chips. 
  170. A sensible voltage to stick into the regulator is 8 volts.  Personally I
  171. wouldn't go for anything above 12 volts though.
  172. Saying all that I have designed the power supply bit with a 'crow bar'
  173. circuit stuck on its output.  If the regulators output voltage should rise
  174. above about 5.6 volts it simply shorts out the output, instantly cutting
  175. power to the board and blows the safety fuse (good eh?).  One of those
  176. adaptors you can get from Tandy or other places will do.  If you have
  177. something like a games console you could throw away the console and use the
  178. power supply to power the grabber {8-).  An old Spectrum supply or even a
  179. Commodore 64 supply would work fine (I didn't like the C64 I had a nice
  180. Commodore Plus 4.  I also had a plethora of ZX Spectrum's but alas they are
  181. all a bit strange now (2 half work in a strange 16k mode!))
  182.  
  183. Yikes I've only been typing half an hour and look at all the junk I have
  184. churned out!
  185.     
  186. Oscillator.
  187.  
  188. The oscillator is a crystal controlled one.  Comprising of 3 inverters, 2
  189. resistors, 1 capacitor and the crystal.  If you want you could replace the
  190. oscillator with a ready built clock module operating at the same frequency
  191. as the crystal.  This has no benefit only it makes the construction very
  192. slightly easier (Saves you soldering 4 components woopee).  I haven't tried
  193. the module thing so don't blame me if you decide to be lazy and stick one
  194. in and it doesn't work. (Anyway what's wrong with my circuit?)
  195.  
  196.  
  197. Decoupling.
  198.  
  199. The circuit should be well decoupled with capacitors.  The capacitors of
  200. about 100nF should be soldered directly across the supply pins of the
  201. chips.  This could be done on the solder side of the board.  This simply
  202. removes any electrical noise on the supply.  When I was building this I
  203. went over the top a little with the decoupling but this has no side
  204. effects.
  205.  
  206. Construction techniques.
  207.  
  208. There is no PCB yet (and is unlikely to ever be one).  It could be built on
  209. strip board.  Mine is built on general purpose printed circuit board.
  210.  Thousands of holes with copper pads for each hole on the other side.  All
  211. the connections are made with solid wire.  Telephone extension wire has a
  212. rubbish plastic insulator which shrinks like mad when heated!  Computer
  213. communications cable seems to work best.  LAN cable is widely available and
  214. comes with quite a few conductors,  A meter of this cable should see you
  215. through this project with ease.  Anyway its up to you to construct in the
  216. way you are most comfortable.
  217.  
  218. Box.
  219.  
  220. If a metal box is available use it.  I used a box from a bit of old British
  221. Telecom equipment I bought from an electronics sale.  Although shielding
  222. would be recommended I don't know if it has much effect in this project.
  223.  All I did was back a sheet of aluminium foil in sticky back plastic on
  224. both sides and hot glued this to the inside of my plastic box!
  225. If you don't want to fork out for a metal box a biscuit tin would work.  It
  226. may look a bit crudd when you have finished but screening is excellent.  If
  227. it works for a pirate radio transmitter this project will be no problem!
  228.  
  229. Parts list.
  230.  
  231. Wot u need.
  232.  
  233. IC's
  234. 1..74HC04 (OR LS but HC is better ;-)
  235. 2..74LS74
  236. 1..74LS08 (RECOMMEND 74HC08 SEE TEXT)
  237. 1..74HC4040
  238. 1..74HC4024
  239. 1..CA3306  FLASH A/D
  240. 1..431000  (85ns CMOS STATIC RAM 128Kbytes or 1Mbit)
  241. 1..7805
  242. 1..CF106D  (THYRISTOR (SCR) SEE TEXT)
  243.  
  244. Discrete components.
  245. 6..BC547
  246. 2..BC557
  247. 2..LED'S
  248. 1...75R
  249. 14..1K
  250. 5...2K2
  251. 1...10K
  252. 2...470R
  253. 4...47K
  254. 2...18K
  255. 4...4K7
  256. 1...33K
  257. 1...5K MULTI TURN PRESET
  258. 1...10nF
  259. 1...68pF
  260. 1...560pF
  261. 4...100nF
  262. 2...1nF
  263. 1...15nF
  264. 3...220nF
  265. 2...10uF
  266. 1...22uF
  267. 1...1000uF
  268. 4...1N4148 (OR 1N914)
  269. 1...5V6 500mW ZENER  (SEE TEXT)
  270. 1...1A FUSE (AND HOLDER)
  271. About 10, 100nF caps. for decoupling.
  272.  
  273. 25 pin male D connector.
  274.  
  275. Board, Box, Phono plugs(Video input) , SPDT pushbutton (2 off)
  276.  
  277. See text stuff:
  278. The SCR, Zener, and associated components (shown in dotted box in PSU
  279. schematic) can be omitted if you want.  These are included to provide a
  280. 'crowbar'.  Should the 7805 fail due to some weird space ray or something
  281. the SCR will switch on, shorting out the supply and blowing the 1A safety
  282. fuse.  This stops any of your chips being fried (with a nice piece of cod
  283. and a tub of peas please!)
  284. Dont use a 74LS08 in place of a 74HC08.  Some LS's may work but its a bit
  285. dodgy.  Because I have used two diodes instead of an OR gate the level
  286. at the other side of the diodes may not be sufficient enough for the
  287. counters to see it a a valid logic level.  So use HC.
  288.  
  289. Setting up.
  290. After building there is only one piece of setting up to do really.
  291. With a volt meter set the voltage at pin 9 of the ADC (CA3306) with the aid
  292. of the multi turn pot. to 4 volts.
  293.  
  294. First tests.
  295. Assuming you have used sockets for all the chips, before plugging the chips
  296. in and powering up do some checks.
  297. Check you have approx. 5 volts on the power pins of the IC sockets.  This
  298. is all you have to check really.
  299. Start off by inserting the 74LS04.  Power up and check for a fast output at
  300. pin 6.  Use a logic probe, oscilloscope etc..  If you don't have any of
  301. these and can't borrow one (You are advised to borrow one from somewhere)
  302. Get a small length of wire and stick it into the socket at pin 6, plug in
  303. the 74LS04 and use a short wave radio tuned to 6.5MHz, you should get a
  304. noise if the oscillator is working.
  305. Failing the radio test:-
  306. Ultra simple logic probe.
  307.  
  308. U need (You don't have to build this but if you don't have a logic probe
  309. get one or build this)
  310. 74HC04 (For low input currents. You could also use 4049)
  311. 330 to 470 ohm resistors (you need 2)
  312. Red LED and a Green LED
  313. Strip board, wire, croc clips, etc..
  314.  
  315. This will probably look like junk:-
  316.  
  317.                                                         5v 
  318.                                |\                       |  
  319.                       +--------| O---------330R--RLED---+  
  320.                       |        |/                       |  
  321.  Probe tip <----------|                                 |  
  322.                       |        |\    |\                 |  
  323.                       +--------| O---| O---330R--GLED---+  
  324.                                |/    |/                    
  325.  
  326. Its sort of simple to follow!
  327. When the probe tip is high the red LED will light.
  328. When the probe tip is low the green LED will light.
  329. Even with nothing connected to the probe you will probably get something
  330. lighting up because of floating voltages and junk like that.
  331.  
  332. With a logic probe connected to pin 6 of the 74LS04 both LED's should light
  333. and no flicker between them should occur.
  334. Next insert the 74LS74 which is connected to the capture switch.  At the Q
  335. output there should be a logic '1' high.  On pressing the switch this
  336. should go low.
  337. Insert the second 74LS74 the 74LS08, 74HC4040 (CMOS) and the 74HC4024
  338. (CMOS).  Power up and test pin 5 of the 2nd 74LS74.  Should be low going
  339. high and staying there when switch is pressed.  Pins 11 and 2 on the CMOS
  340. counters (74HC4040 and 74HC4024) should be low.  Next apply a video signal
  341. from your recorder or the composite video out on the back of your Amiga
  342. *8-)
  343. On pressing capture switch a short burst of oscillations should be present
  344. at 74LS08 pin 6 and also at 74LS08 pin 11 and also at 74LS04 pin 10.
  345. After switch press output from CMOS counters should all be low.
  346. Press and hold the capture switch.  The LED (Not power) should remain lit.
  347.  On release of the switch it should go out.
  348. Plug in other remaining chips.  After powering up check all chips
  349. especially RAM chip and A/D converter for heat.  None should get even warm
  350. If any get warm disconnect power and check wiring!
  351. This reminds me of a bit in the ZX Spectrum service manual:-
  352.  
  353. Symptom                Action
  354.  
  355. On switch on smoke     Disconnect power
  356. appears.               immediately.
  357.  
  358. Now then.  Turn everything off (Amiga and frame grab).  Plug in frame grab
  359. to parallel port.  Switch on monitor, switch on Amiga, switch on FG.
  360. If amiga doesn't come on or boot up switch off immediately, check wiring.
  361. If it boots up everything must be OK.  Check heat on chips again.
  362.  
  363. No conflict should occur between Amiga and FG because of 1K resistors on
  364. data bus of FG.
  365.  
  366.  
  367. Fault finding.
  368.  
  369. Because construction has been left to you this section may not be to
  370. helpful.
  371.  
  372. Pressing capture button with a video signal going in can cure some faults
  373. Hold the capture button in.  The active LED should remain lit.
  374. If the active LED just gives a short flash replace the 74??08.
  375. If you have used anything but a 74HC08 this chip is suspect, change it for
  376. a HC version.
  377.  
  378. Captures OK but loads of noise visible through the software (Display
  379. Graph option)
  380. Again I have found that the use of anything but a 74HC08 causes random
  381. noise and oscillations.
  382. Since all the oscillator output goes through the 74HC08 using a LS tends to
  383. cause problems.
  384.  
  385.  
  386. In use.
  387. Well you have a composite video signal going in.  You watch on a separate
  388. TV for the image you want and then press the capture button.  It is
  389. advisable to press the capture button before the image you want comes up.
  390.  This captures a picture you don't want but also resets the internal
  391. counters of the FG ready for the piccie you do want 8-}
  392. Then use the FG software executed from Workbench.
  393. Select transfer data.  The LED (NOT power) on the FG should begin to
  394. flicker or just light up.
  395. After a couple of seconds or so, everything stops!
  396. Now select Decode and watch the piccie appear before you.
  397. Depending on your machine this may take a while.
  398. The speed of this is acceptable on an unexpanded A1200 but is a lot better
  399. when accelerated!
  400.  
  401. Greyscale offset.
  402. The picture may be a bit dark or light.  Adjust the greyscale offset to
  403. adjust brightness etc..  You could also do this with DPaint or something
  404. after saving the IFF image.  Just play with the colour palette.
  405. You can save the RAW video data or load it to/from a file (131072 bytes).
  406. You can get the software to display a greyscale for general setting up and
  407. stuff like that!
  408. To get the best from the decoding process the offset should be set at the
  409. current signals 'black' level.  This can now be done within the draw graph
  410. option in the software.  Allign the offset with the top of the sync. pulses
  411. on the signal.
  412.  
  413. Selecting contrast enhance, enhances the contrast!
  414. Do this only after decoding the current image and don't adjust the
  415. parameters after decoding the image.
  416. Use this if the image is generally to dark.
  417.  
  418. Obtaining a video signal.
  419. On the back of most VCR's is a video out socket, use this.
  420. If you have equipment with a scart socket there are video out pins from
  421. that.  You will have to find out which pins yourself!
  422. OK then I'll look up the pins for you.
  423. On PERITEL/SCART socket pins for video are as follows:
  424. Video out - 19
  425. Video ground - 17
  426.  
  427. Producing a colour image!
  428. As I remember there are seperate Red, Green and Blue signals available
  429. from the SCART connector.  To produce a colour image from the current
  430. hardware (This is experimental, I havn't tried this yet!) you would need
  431. a still image and capture three versions of the image to give you the
  432. separate RGB components.  Then using some Gfx conversion software stick
  433. the three together to produce yer colour image.
  434.  
  435. Frame grab, the next generation!
  436.  
  437. I think I will be changing and messing around with the hardware and
  438. software.  You can look forward to:-
  439. Colour images (coming soon)
  440.  
  441. Higher quality images
  442. Double the sampling frequency to about 13.5MHz doing this requires twice as
  443. much memory in the FG BUT! instead of buying two RAM chips (bank loan
  444. etc..) I will use commonly available SIM's (256K)  These are relatively
  445. cheap and since they are 9 bit (8-bits and one parity bit) maybe I could go
  446. for an 8-bit A/D converter which would give a better colour range and
  447. reduce quantization error!
  448.  
  449. Real time stuff!
  450. Where the Amiga is constantly downloading info and building an image and
  451. the FG is constantly capturing images.  So you could watch what was
  452. happening on the screen and if you liked a piccie you just click and data
  453. transfer stops until you have saved and clicked continue.
  454. I don't know about the current software for this (Its a bit slow).
  455.  
  456. And really anything else I can think of to improve it.
  457. If you have any ideas or questions don't hesitate to contact me.
  458.  
  459. Lee Atkins
  460. 49 Park Lane
  461. OSWALDTWISTLE
  462. LANCASHIRE
  463. ENGLAND
  464. BB5 3AF
  465.  
  466. OR E-Mail me at L.A.ATKINS@UCLAN.AC.UK
  467.  
  468. I cant think of
  469. anything else to type so I'll shut up now and let you get on with some
  470. soldering!
  471.  
  472. Bye.
  473.  
  474.  
  475. EOF.
  476.